<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
<h:head>
<h:outputStylesheet library="css" name="default.css" target="head" />
</h:head>
<h:body>
#{friendPresBean.onLoadUser()}
<h:form id="form">
		 <h:panelGrid columns="4">  
		 <h:outputText value="é necessario inserire sia nome che cognome per la ricerca. Entrambi i nomi sono necessari"></h:outputText>
            <h:outputLabel for="firstname" value="Firstname: *" />  
            <p:inputText id="firstname" value="#{friendPresBean.nomeUtente}" required="true" label="Firstname" immediate="true">  
                <f:validateLength minimum="2" />  
            </p:inputText>  
            
            <h:outputLabel for="surname" value="Surname: *" />  
            <p:inputText id="surname" value="#{friendPresBean.cognomeUtente}" required="true" label="Surname" immediate="true"/>  
          	<p:commandButton id="btn" value="Cerca" actionListener="#{friendPresBean.findUtente}" update="utenti"/>  
        </h:panelGrid>  
        
        <p:dataList value="#{friendPresBean.utenti}" var="utente" id="utenti"  
        paginator="true" rows="5"  
        paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"  
        rowsPerPageTemplate="5,10,15" type="none">  
  
            <f:facet name="header">  
                Utenti
            </f:facet>  
  
             <p:commandButton icon="ui-icon-search" title="View Detail" action="GiftListUtente?faces-redirect=true">  
                <f:setPropertyActionListener value="#{utente}" target="#{friendPresBean.utenteSelezionato}" />  
            </p:commandButton> 
  
            <h:outputText value="#{utente.firstName}, #{utente.lastName}" style="margin-left:10px" />  
            <br />  
    	</p:dataList>
  </h:form>      
</h:body>
</html>